<?php
class AddressesController extends AppController {
    var $name = 'Addresses';
	var $helpers = array('Html', 'Form');
	var $paginate=array(
	           'limit'=>'20',
	           'order'=>array('Adresses.id'=>'asc')
	       );
	       
	function admin_index(){
	    $this->set("addresses",$this->paginate());
	}
	
	
    function admin_view($id=null){
	    if(!$id){
	        $this->Session->setFlash("Address is invalid!");
	    	$this->redirect(array('action'=>'index'));//ezzel ugrik vissza az előző oldalra
	    }
	    $this->set('addresses',$this->Addresses->read(null,$id));
	}
	
	function view ($id=null){
	    if(!$id){
	        $this->Session->setFlash("Address is invalid!");
	    	$this->redirect(array('action'=>'index'));//ezzel ugrik vissza az előző oldalra
	    }
	    $this->set('addresses',$this->Addresses->read(null,$id));
	}
	
}
?>